﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcApplication1.Models;

namespace MvcApplication1.Controllers
{
    public class QuanLyKhachHangController : Controller
    {
        //
        // GET: /QuanLyKhachHang/

        public ActionResult DanhSach()
        {
            DataClassesDataContext dataContext = new DataClassesDataContext();
            var dsKhachHang = from khachHang in dataContext.KhachHangs select khachHang;
            List<KhachHangModel> dsKhachHangModels = new List<KhachHangModel>();
            foreach (KhachHang khachHang in dsKhachHang)
            {
                KhachHangModel khachHangModel = new KhachHangModel();
                khachHangModel.tenDangNhap = khachHang.UserName;
                khachHangModel.hoTen = khachHang.TenKH;
                khachHangModel.email = khachHang.Email;
                khachHangModel.soDienThoai = khachHang.SoDT;
                khachHangModel.diaChi = khachHang.DiaChi;
                dsKhachHangModels.Add(khachHangModel);
            }
            ViewBag.dsKhachHangModels = dsKhachHangModels;
            ViewBag.MenuClass = Session["MenuClass"];
            return View();
        }

    }
}
